package view;
import javax.swing.*;

import java.awt.*;

/**
 * Represents the manager's work space screen.
 * 
 * @author Kenny Chong, Dan End, James Ju
 * CSE 333 : User Interface
 * Project HMSystem
 */
public class WorkSpacePanel extends JPanel
{
	// Variables.
	private HMSView parentFrame;
	private MessagePanel messagePanel;
	private LoginPanel login;
	private EmployeesPanel employeesPanel;
	private FloorPanel floorPanel;
	private HomePage homepagePanel;
	private BudgetPanel budgetPanel;
	//Layout
	private CardLayout cardLM;
	
	/**
	 * Class Constructor
	 * @param parent
	 */
	public WorkSpacePanel(HMSView parent){
		//Initialize parentFrame
		this.parentFrame = parent;
		
		//Set the Layout for this JPanel to CardLayout
		cardLM = new CardLayout();
		this.setLayout(cardLM);
		
		//Create our JPanels
		messagePanel = new MessagePanel();
		employeesPanel = new EmployeesPanel();
		floorPanel = new FloorPanel();
		homepagePanel = new HomePage(this);
		budgetPanel = new BudgetPanel();
		
		//Add the JPanels to this Component
		this.add(homepagePanel, "homepagePanel");
		this.add(messagePanel, "messagePanel");
		this.add(employeesPanel, "employeesPanel");
		this.add(floorPanel, "floorPanel");
		this.add(budgetPanel, "budgetPanel");

	}

	/**
	 * Switches between the panels
	 */
	public void setPanel(String name)
	{
		cardLM.show(this,name);
	}
	
	/**
	 * Retrieve current panel.
	 */
	public JPanel getCurrentPanel(String panelName)
	{
		if (panelName.equals("floorPanel"))
		{
			return floorPanel;
		}
		
		return null;
	}
}
